Handle WindowManager.getCurrent() safely on Linux Wayland#7
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/libnativeapi/nativeapi-flutter/sessions/0c7fb074-d8cc-4d7e-b14a-6158ea3c2602 Co-authored-by: lijy91 <3889523+lijy91@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error when getting current window in Flutter on Linux
Handle May 24, 2026
WindowManager.getCurrent() safely on Linux Wayland
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux Wayland/XWayland sessions, calling
WindowManager.getCurrent()can hit a GTK/GDK assertion path (gdk_device_get_window_at_position_double) and emit critical errors when resolving the current window.Problem summary
getCurrent()relied on a native “current focused window” lookup that is not reliable under Wayland session semantics in this environment.What changed
WindowManager(WAYLAND_DISPLAY/XDG_SESSION_TYPE=wayland).getCurrent()to use a safe fallback on Wayland:getAll()(ornullif none),native_window_manager_get_current()call in this path.Resulting behavior
Window?) and existing behavior elsewhere.